<template>
	<view class="indexBig">
		
		<!-- 系统倒计时。不显示，但不可删，否则各店铺的倒计时会失效 -->
		<view class="swiperContent" v-show='false' >
			<swiper style="height:200px" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
				<swiper-item>
					<view class="countDown">
						<view class="countCount">
							<view class="">距结束</view>
							<view class="">
								<view class="">
									<Flipper :total="2" :current="countInfo.systemHour1"></Flipper>
									<Flipper :total="9" :current="countInfo.systemHour2"></Flipper>
								</view>
								<view class="point">:</view>
								<view class="">
									<Flipper :total="5" :current="countInfo.systemMinute1"></Flipper>
									<Flipper :total="9" :current="countInfo.systemMinute2"></Flipper>
								</view>
								<view class="point">:</view>
								<view class="">
									<Flipper :total="5" :current="countInfo.systemSecound1"></Flipper>
									<Flipper :total="9" :current="countInfo.systemSecound2"></Flipper>
								</view>
							</view>
						</view>
					</view>
				</swiper-item>
			</swiper>
		</view>

		<!-- 店铺列表 -->
		<view class="storeListBox hotelBox" v-show='shopListForAll.length > 0 && shopList.length == 0'>
			<view class="hotellList" v-for="(item, index) in shopListForAll" :key="index">
				<view class="hotelInfo" @click="clickStoreItem(item)">
					<image :src="item.logo | getImg" mode="aspectFill"></image>
					<view class="topRight">
						<view class="">
							<view class="">{{ item.storeName }}</view>
							<view class="notEnd" v-if="item.businessState == '营业'">
								<!-- 营业时间 -->
								<view class="">距结束</view>
								<view class="">
									{{ countInfo[`hour${index}`] }}:{{ countInfo[`minute${index}`] }}:{{ countInfo[`secound${index}`] }}
								</view>
							</view>
							<view class="end" v-else>
								营业时间
								<text>歇业中</text>
							</view>
						</view>
						<view class="">
							<!-- <view class="">人均价格 <text>￥{{item.perCapita}}</text></view> -->
							<!-- <view class="">人均价格 <text>￥10</text></view> -->
							<view class="">
								口味
								<text>{{ item.flavorScore }}分</text>
							</view>
							<view class="">
								包装
								<text>{{ item.packagingScore }}分</text>
							</view>
							<view class="">
								份量
								<text>{{ item.componentScore }}分</text>
							</view>
						</view>
						<view class="timeAndFavorite">
							<view class="">
								营业时间
								<text>{{ item.businessTime }}</text>
							</view>
							<image v-if='item.isFavorite == "1"' class='ai-xin' src="../../static/aiXin_red.png"
								mode="aspectFill" @click.stop="toggleFavorite(0, item)"></image>
							<image v-else class='ai-xin' src="../../static/aiXin.png" mode="aspectFill"
								@click.stop="toggleFavorite(1, item)"></image>
						</view>
						<view class="">{{ item.storeDescription }}</view>

						<!-- 平台描述 -->
						<view class='des-box'>
							<view class='des-item' v-for='des in item.desList'>{{ des }}</view>
						</view>
					</view>
				</view>


			</view>
		</view>
		<view v-show='!shopListForAll.length' class='empty-data'>
			<u-empty text="没有找到相关数据" mode="page"></u-empty>
		</view>



		<!-- 菜品列表 -->
		<view class="hotelBox" v-if='shopList.length > 0'>
			<view class='food-back-btn' @click='backToStoreList'>
				<u-icon name="arrow-left" size="36" style="margin: 6rpx;"></u-icon>
			</view>
			<view class="hotellList" v-for="(item, index) in shopList" :key="index">
				<view class="hotelInfo" @click="showStoreDet(item)">
					<image :src="item.logo | getImg" mode="aspectFill"></image>
					<view class="topRight">
						<view class="">
							<view class="">{{ item.storeName }}</view>
							<view class="notEnd" v-if="item.businessState == '营业'">
								<!-- 营业时间 -->
								<view class="">距结束</view>
								<view class="">
									{{ countInfo[`hour${index}`] }}:{{ countInfo[`minute${index}`] }}:{{ countInfo[`secound${index}`] }}
								</view>
							</view>
							<view class="end" v-else>
								营业时间
								<text>歇业中</text>
							</view>
						</view>
						<view class="">
							<!-- <view class="">人均价格 <text>￥{{item.perCapita}}</text></view> -->
							<!-- <view class="">人均价格 <text>￥10</text></view> -->
							<view class="">
								口味
								<text>{{ item.flavorScore }}分</text>
							</view>
							<view class="">
								包装
								<text>{{ item.packagingScore }}分</text>
							</view>
							<view class="">
								份量
								<text>{{ item.componentScore }}分</text>
							</view>
						</view>
						<!-- <view class="">
							<view class="">
								营业时间
								<text>{{ item.businessTime }}</text>
							</view>
						</view> -->
						<view class="timeAndFavorite">
							<view class="">
								营业时间
								<text>{{ item.businessTime }}</text>
							</view>
							<image v-if='item.isFavorite == "1"' class='ai-xin' src="../../static/aiXin_red.png"
								mode="aspectFill" @click.stop="toggleFavorite(0, item)"></image>
							<image v-else class='ai-xin' src="../../static/aiXin.png" mode="aspectFill"
								@click.stop="toggleFavorite(1, item)"></image>
						</view>

						<view class="">{{ item.storeDescription }}</view>
					</view>
					<!-- <view class="fixBox" v-if="item.businessState!='营业'">该商家已打烊</view> -->
				</view>


				<view class="shopContent">
					<view class="shopList" v-for="(foodItem, foodIndex) in item.hcCommodityList" :key="foodIndex">
						<view class="imgContent">
							<!-- <image :src="foodItem.productPicture|getImg" mode=""></image> -->
							<u-lazy-load :image="foodItem.productPicture | getImg" :loading-img="loadingImg"
								img-mode=""></u-lazy-load>
							<view class="must" v-if="foodItem.requiredFlag == '是'">必选</view>
						</view>
						<view class="shopInfo">
							<view class="shopName">{{ foodItem.tradeName }}</view>
							<view class="shopDescribe">{{ foodItem.productDescription }}</view>
							<view class="control">
								<view class="" v-if="foodItem.limitBuy <= -1">
									<text class="price">
										<text>￥</text>
										{{ foodItem.commodityPriceCache }}
									</text>
								</view>
								<view class="surplus" v-else>
									<view>
										<text class="price">
											<text>￥</text>
											{{ foodItem.commodityPriceCache }}
										</text>
									</view>
									<view>剩余{{ foodItem.remainingQuantity }}</view>
								</view>
								<view class="specConetnt" v-if="foodItem.hasSpec">
									<view class="selSpec" @click="showSpecAlert(index, foodIndex)">
										<view class="">选规格</view>
									</view>
									<view class="num" v-if="foodItem.num > 0">{{ foodItem.num }}</view>
								</view>
								<view class="showInput" v-else>
									<svg @click="changeShopNum('down', index, foodIndex, foodItem, item)"
										t="1672841614542" class="icon" viewBox="0 0 1024 1024" version="1.1"
										xmlns="http://www.w3.org/2000/svg" p-id="5146" width="18" height="18">
										<path d="M170.666667 469.333333h682.666666v85.333334H170.666667z" fill="#444444"
											p-id="5147"></path>
									</svg>
									<u-input v-model="foodItem.num" :clearable="false" :disabled="true" />
									<svg @click="changeShopNum('add', index, foodIndex, foodItem, item)"
										t="1672841289544" class="icon" viewBox="0 0 1024 1024" version="1.1"
										xmlns="http://www.w3.org/2000/svg" p-id="3814" width="15" height="15">
										<path
											d="M939.939489 459.072557 562.339502 459.072557 562.339502 83.519182 462.055494 83.519182 462.055494 459.072557 84.455507 459.072557 84.455507 559.356564 462.055494 559.356564 462.055494 939.003164 562.339502 939.003164 562.339502 559.356564 939.939489 559.356564Z"
											fill="#272636" p-id="3815"></path>
									</svg>
								</view>
							</view>
						</view>
						<!-- </block> -->
					</view>
				</view>

			</view>
			
		</view>


		<!-- 购物车底部 -->
		<view class="shopCarBottom">
			<view class="">
				<view class="" @click="changeShopCarShow">
					<u-icon name="shopping-cart" size="60"></u-icon>
					<div class="num" v-if="shopCarInfo.total > 0">{{ shopCarInfo.total }}</div>
				</view>
				<view class="">￥{{ shopCarInfo.totalPrice ? shopCarInfo.totalPrice : 0 }}</view>
			</view>
			<!-- @click="goToPage('createOrder')" -->
			<view :class="{ dis: shopCarInfo.total <= 0 }" @click="checkShopCarInfo">去结算</view>
		</view>

		<CommenFooter :checkIndex="3"></CommenFooter>
		<view class='btn-v-console' @click='togglevc'></view>

		<!-- 规格选取弹窗 -->
		<view class="specBox">
			<u-popup v-model="specShow" mode="center" :closeable="true">
				<div class="specContent">
					<view>{{ specInfo.name }}</view>
					<view class="specList" v-for="(item, index) in specInfo.specList" :key="index">
						<view class="">{{ item.name }}</view>
						<view class="">
							<view v-for="(specItem, specIndex) in item.child" :key="specIndex"
								:class="{ specCheckList: specItem.checked }" @click="changeSpecCheck(index, specIndex)">
								<view class="">{{ specItem.name }}</view>
								<view v-if="specItem.price && !specInfo.hasPrice">{{ specItem.price }}</view>
							</view>
						</view>
					</view>
				</div>
				<view class="specControl">
					<view class="">
						总计
						<text>￥{{ specInfo.total }}</text>
					</view>
					<view class="" @click="changeShopNum('spec')">加入购物车</view>
				</view>
			</u-popup>
		</view>
		<!-- 购物车列表 -->
		<view class="shopCarBox" v-if="shopCarShow">
			<view class="shopCarContent">
				<view class="" v-if="shopCarInfo.shopCarList.length != 0">
					<view class=""></view>
					<view class="" @click="emptyShopCar">
						<u-icon name="trash" size="36"></u-icon>清空购物车
					</view>
				</view>
				<view class="listContent">
					<view class="shopList" v-for="(item, index) in shopCarInfo.shopCarList" :key="index">
						<view class="">
							<image :src="item.logo | getImg" mode="aspectFill"></image>
							<view class="">
								<view class="">{{ item.storeName }}</view>
								<view class="">{{ item.storeDescription }}</view>
							</view>
						</view>
						<view class="foodList" v-for="(foodItem, foodIndex) in item.hcShoppingCartList"
							:key="foodIndex">
							<!-- <checkbox value="index" :checked="foodItem.checked" ref="childCheckBox" /> -->
							<view class="" style="margin-left: 10px;">
								<image :src="foodItem.hcCommodity.productPicture | getImg" mode="aspectFill"></image>
								<view class="">
									<view class="">{{ foodItem.hcCommodity.tradeName }}</view>
									<view class="" v-if="foodItem.commoditySpecifications">
										规格：{{ foodItem.commoditySpecifications }}</view>
									<view class="">
										<view class="">
											￥{{
												foodItem.hcCommodity.commodityPriceCache
													? accMul(foodItem.hcCommodity.commodityPriceCache, foodItem.commodityQuantity)
													: foodItem.commodityPrice
											}}
										</view>
										<view class="">
											<svg @click="shopCarWithChangeNum('down', foodItem, item, foodIndex, index)"
												t="1672841614542" class="icon" viewBox="0 0 1024 1024" version="1.1"
												xmlns="http://www.w3.org/2000/svg" p-id="5146" width="18" height="18">
												<path d="M170.666667 469.333333h682.666666v85.333334H170.666667z"
													fill="#444444" p-id="5147"></path>
											</svg>
											<u-input type="text" :clearable="false" v-model="foodItem.commodityQuantity"
												placeholder="1" :disabled="true" />
											<svg @click="shopCarWithChangeNum('add', foodItem, item, foodIndex, index)"
												t="1672841289544" class="icon" viewBox="0 0 1024 1024" version="1.1"
												xmlns="http://www.w3.org/2000/svg" p-id="3814" width="15" height="15">
												<path
													d="M939.939489 459.072557 562.339502 459.072557 562.339502 83.519182 462.055494 83.519182 462.055494 459.072557 84.455507 459.072557 84.455507 559.356564 462.055494 559.356564 462.055494 939.003164 562.339502 939.003164 562.339502 559.356564 939.939489 559.356564Z"
													fill="#272636" p-id="3815"></path>
											</svg>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				<u-empty text="没有购物车数据,快去挑选商品吧" mode="page" v-if="shopCarInfo.shopCarList.length == 0"></u-empty>
			</view>
		</view>

		<view class="blackBox" :class="{ show: shopCarShow }" @click="shopCarShow = false"></view>
		<u-toast ref="uToast"></u-toast>
		<!-- 当前门店资质 -->
		<view class="storeDet">
			<u-popup v-model="storeDetailVisiable" mode="top" @touchmove.stop.prevent="" :closeable="false">
				<view class="storeContent">
					<view class="">{{ clickStoreInfo.name }}--门店资质</view>
					<image :src="item | getImg" mode="aspectFill" v-for="(item, index) in clickStoreInfo.qualifications"
						:key="index"></image>
				</view>
			</u-popup>
		</view>
		<MyLoading :showLoading="showLoading" :text="loadingText"></MyLoading>
		<view class="warnBox" :class="{ warnBoxShow: warnShow }">
			<view class="">该商家已经打烊</view>
		</view>
	</view>
</template>

<script>
	import {
		saveMyAddress,
		getMainCategories,
		getStoreListWithClass,
		getSystemInfo,
		addShopCar,
		getShopCarList,
		getLatelyAddress,
		emptyShopCar,
		getCreateOrderNum,
		getAddressList,
		getAddressById,
		getMyInfo,
		countDayViews,
		setOpenId,
		checkShopCarInfo,
		delFavoriteMerchant,
		addFavoriteMerchant,
	} from '@/utils/req/api.js';
	import MyMinix from '@/utils/minix/minix.js';
	import CommenFooter from '@/components/footer/footer.vue';
	import Flipper from '@/components/Flipper/Flipper.vue';
	import MyLoading from '@/components/loading/loading.vue';

	import loadingImg from '@/static/loading.png'
	export default {
		mixins: [MyMinix],
		components: {
			CommenFooter,
			Flipper,
			MyLoading
		},
		data() {
			return {
				loadingImg,
				showLoading: false,
				loadingText: '加载中...',
				shopListForAll: [], // 点餐页面展示的所有店铺
				shopList: [], 		// 当前选中以进入菜品详情的 1个 店铺。用数组保持原来的格式。相当于index页面中所有展示的店铺集合

				myInfo: {}, // 用户信息
				closeable: true, //地址选择框是否可关闭
				myAddress: {
					id: '',
					addressName: ''
				}, //我当前的位置
				mainCategorieList: [], //品类列表
				storeName: '', //搜索输入框的双向绑定值
				mainCategoriesId: '', //我所点击的品类ID

				//系统倒计时的信息
				countInfo: {
					personNum: 0,
					// hour: '00',
					// minute: '00',
					// secound: '00',
					systemSecound1: 0,
					systemSecound2: 0,
					systemMinute1: 0,
					systemMinute2: 0,
					systemHour1: 0,
					systemHour2: 0,
					timer: ''
				},
				timerList: [],

				orderList: [], //当前定位地址对应的下单列表
				orderListShow: false, //当前已下单列表弹窗的显隐

				posiShow: false, //位置弹窗的显隐
				addressList: [], //所有地址

				specShow: false, //规格弹窗显隐
				specInfo: [], //所展示商品的规格信息

				shopCarShow: false, //购物车的显隐
				shopCarInfo: '', //购物车列表数据
				hasAllCheck: false, //购物车全选按钮的状态，


				clickStoreInfo: '', //点击商家名称记录的临时信息
				storeDetailVisiable: false,

				orderPageNo: 1, //当前地址下单列表的页码
				orderPageSize: 10, //当前地址下单列表的每页数量
				moreOrderFlag: false, //加载当前地址下单列表的防抖开关
				storePageNo: 1, //门店列表的页码
				storePageSize: 10000, //门店列表的每页数量

				warnShow: false,

				shakeFlag: false,

				orderVisible: true, //是否有上一次的订单未查询支付结果

				froms: '', //从哪来

				isSpecial: null,
			};
		},
		onLoad(options) {
			this.showLoading = true;
			countDayViews();
		},
		mounted() {

			if (uni.getStorageSync('orderCreateResult')) {
				this.getPayResut();
			}

			// 获取我的信息。收藏接口使用。
			getMyInfo().then(res => {
				if (res.data.code == 200) {
					this.myInfo = res.data.result;
					console.log('我的信息：', res.data.result)
				}
			})
		},
		
		destroyed() {
			// clearInterval(this.timer);
		},
		onShow() {
			if (this.countInfo.timer) {
				clearInterval(this.countInfo.timer);
			}

			this.getSystemInfo(this.countInfo); //不需要地址id

			let fun = () => {
				if (uni.getStorageSync('myCheckAddress') && uni.getStorageSync('myCheckAddress') != 'null') {
					let myAddress = JSON.parse(uni.getStorageSync('myCheckAddress'));
					if (!this.isSpecial && myAddress.id == '1701420180111917057') {
						// 不是由#bcwl链接跳转来的、但上一单是在冰川网络下单的。
						uni.removeStorageSync('myCheckAddress')
						this.getAddressList();
					} else {
						this.myAddress = myAddress;
						getAddressList().then(res => {
							this.addressList = res.data.result;
						});
						this.getCreateOrderNum();
						this.getMainCategories();
						this.getStoreList(false, false);
						this.getShopCarList();
					}
				} else {
					this.getAddressList();
				}
			}

			if (this.isSpecial) {
				getAddressList().then(res => {
					this.addressList = res.data.result;
					let checkItem = res.data.result.filter(item => {
						return item.id == '1701420180111917057'
					})[0]
					uni.setStorageSync('myCheckAddress', JSON.stringify(checkItem));
					fun();
				});

			} else {
				fun();
			}

		},
		onReady() {},
		methods: {
			
			// 初始化倒计时数据。--覆盖minix.js的方法，主要是 “this.shopListForAll.forEach”不同
			initCountDown(type, arr) {
				let timer = setInterval(() => {
					console.log('aabb--')
					if (type == 'system') {
						this.formatCountDown(type, arr);
					} else {
						this.shopListForAll.forEach((item, index) => {
							this.formatCountDown(type, JSON.parse(item.businessHours), index);
							
							// this.fixedPriceToDiscount用来判断非企业订单的组件引用了该minix。企业订单无限时优惠。
							// 开启了限时优惠。
							if (this.fixedPriceToDiscount && item.isDiscountEnable && false) {
								let disArr = [
									{startTime: item.discountStartTime, endTime: item.discountEndTime}
								]
								this.formatCountDown('discount', disArr, index);
							}
						});
					}
				}, 1000)
				this.timerList.push(timer);
				this.countInfo.timer = timer;
			},


			//获取支付结果
			async getPayResut(value) {
				value = value ? value : JSON.parse(uni.getStorageSync('orderCreateResult'));
				let payResult = await getPayResult(value);
				uni.removeStorageSync('orderCreateResult');
				console.log('payResult', payResult);
			},

			//获取我的信息
			async getMyInfo() {
				let res = await getMyInfo();
				if (this.isSpecial) {
					// 由#bcwl链接跳转来的，强行给冰川网络的id
					res.data.result.addressId = '1701420180111917057';
				} else {
					if (res.data.result && res.data.result.addressId == '1701420180111917057') {
						// 不是由#bcwl链接跳转来的、但上一单是在冰川网络下单的，重置id，强行让用户重新选择大厦
						res.data.result.addressId = null;
					}
				}

				console.log('我的信息', res);
				let flag = false;
				if (res.data.result && res.data.result.addressId) {
					if (this.addressList && this.addressList.length != 0) {
						let item = this.addressList.find(item => {
							return item.id == res.data.result.addressId;
						});
						console.log('item', item);
						if (item) {
							this.myAddress = item;
							console.log('this.myAddress', this.myAddress);
							flag = true

							if (this.isSpecial) {
								uni.setStorageSync('myCheckAddress', JSON.stringify(item));
							}
						} else {
							this.posiShow = true;
							this.closeable = false;
							flag = false;
						}
					}
				} else {
					this.posiShow = true;
					this.closeable = false;
				}
				// res.data.result.addressId = null;
				if (flag) {
					this.getMainCategories();
					this.getCreateOrderNum();
					this.getStoreList(false, false);
					this.getShopCarList();
				}
				this.showLoading = false;
			},
			//展示门店资质
			showStoreDet(value) {
				this.clickStoreInfo = {
					name: value.storeName,
					qualifications: value.qualifications.split(',')
				};
				this.storeDetailVisiable = true;
			},

			// 点击店铺
			clickStoreItem(item) {
				this.shopList.push(item)
				console.log('点击店铺')
			},

			// 切换收藏店铺
			async toggleFavorite(val, item) {
				let requestFun = val == 1 ? addFavoriteMerchant : delFavoriteMerchant
				let param = {
					merchantId: item.id,
					userId: this.myInfo.id,
				};
				let res = await requestFun(param);
				this.getStoreList(false, false);
			},

			// 从菜品列表返回店铺列表
			backToStoreList() {
				this.shopList = [];
			},

			//获取系统倒计时
			async getSystemInfo(obj) {
				let res = await getSystemInfo();
				let {
					morning_time_begin,
					morning_time_end,
					afternoon_time_begin,
					afternoon_time_end
				} = res.data.result;
				let arr = [{
						startTime: morning_time_begin,
						endTime: morning_time_end
					},
					{
						startTime: afternoon_time_begin,
						endTime: afternoon_time_end
					}
				];
				this.initCountDown('system', arr);
			},
			//获取主营分类
			async getMainCategories() {
				let res = await getMainCategories({
					addressId: this.myAddress.id
				});
				this.mainCategorieList = res.data.result;
			},
			/**
			 * 获取首页商铺和商品列表
			 * isClickCategories：是否是从主营品类点击
			 * isPush：是否是触底加载更多需要push
			 * */
			async getStoreList(isClickCategories, isPush) {
				console.log('isClickCategories', isClickCategories);
				console.log('isPush', isPush);
				if (!isClickCategories) {
					this.mainCategoriesId = '';
				}
				if (!isPush) {
					this.storePageNo = 1;
				}

				let res = await getStoreListWithClass({
					pageNo: this.storePageNo,
					pageSize: this.storePageSize,
					storeName: this.storeName,
					mainCategoriesId: this.mainCategoriesId,
					addressId: this.myAddress.id
				});

				if (!res.data.success) {
					uni.removeStorageSync('myCheckAddress');
					this.$router.go(0);
				}

				console.log('获取商铺列表-----参数addressId:', this.myAddress.id)
				console.log('获取商铺列表-----获取结果数量及数据:', res.data.result.records.length, res.data.result.records)

				let resultList = [];
				res.data.result.records.forEach(item => {

					item.hcCommodityList.forEach(foodItem => {
						foodItem.num = foodItem.shoppingCartCount;
						if (foodItem.specificationsFlag == '是') {
							foodItem.hasSpec = true;
						}
						foodItem.remainingQuantity = foodItem.remainingQuantity - foodItem.num;
						foodItem.remainingQuantity = foodItem.remainingQuantity > 0 ? foodItem
							.remainingQuantity : 0;
					});
					let tempArr = [];
					JSON.parse(item.businessHours).forEach((item, index) => {
						if (item.startTime && item.endTime) {
							tempArr.push(item.startTime + '~' + item.endTime);
						}
					});
					item.businessTime = tempArr.join(',');
					this.initCountDown('store', item, JSON.parse(item.businessHours));
					resultList.push(item);
				});

				if (isPush) {
					this.shopListForAll.push(...resultList);
				} else {
					this.shopListForAll = resultList;
				}

				this.showLoading = false;
			},


			//获取购物车列表
			async getShopCarList() {
				console.log('我在加载购物车');
				let res = await getShopCarList({
					addressId: this.myAddress.id
				});
				let total = 0,
					totalPrice = 0;
				res.data.result.forEach(item => {
					item.hcShoppingCartList.forEach((foodItem, foodIndex) => {
						total = total + foodItem.commodityQuantity;
						foodItem.checked = false;
						totalPrice = this.accAdd(totalPrice, foodItem.commodityPrice);
					});
				});
				this.shopCarInfo = {
					total,
					shopCarList: res.data.result,
					totalPrice
				};
			},
			//获取我当前地址对应的当日下单数
			async getCreateOrderNum(type) {
				let res = await getCreateOrderNum({
					pageNo: this.orderPageNo,
					pageSize: -1,
					addressId: this.myAddress.id
				});
				console.log('length', res.data.result.records.length);
				this.orderList = res.data.result.records;
				this.$nextTick(() => {
					this.$set(this.countInfo, 'personNum', res.data.result.records.length);
					this.$forceUpdate();
				});
			},
			//获取地址列表
			async getAddressList() {
				let res = await getAddressList();
				this.addressList = res.data.result;
				this.getMyInfo();
			},

			//切换主营品类
			changeState(index) {
				this.mainCategoriesId = this.mainCategorieList[index].id;
				// this.getStoreList(true, false);
			},

			//展示位置选择列表
			showPosi() {
				this.posiShow = true;
			},
			//展示商品规格选择弹窗
			showSpecAlert(shopIndex, foodIndex) {
				let checkItem = this.shopList[shopIndex].hcCommodityList[foodIndex];
				let total = 0,
					hasPrice = false;
				let specList = JSON.parse(checkItem.commoditySpecifications);
				console.log('specList', specList);
				specList.forEach(item => {
					item.child.forEach((childItem, childIndex) => {
						childIndex == 0 ? (childItem.checked = true) : (childItem.checked = false);
						childIndex == 0 && (total = Number(total) + Number(childItem.price));
					});
				});
				if (checkItem.commodityPrice) {
					total = checkItem.commodityPriceCache;
					hasPrice = true;
				}
				this.specInfo = {
					shopIndex,
					foodIndex,
					total,
					hasPrice,
					shopId: checkItem.id,
					specList,
					name: checkItem.tradeName,
					num: checkItem.shoppingCartCount,
					storeState: this.shopList[shopIndex].businessState,
					limitBuy: this.shopList[shopIndex].hcCommodityList[foodIndex].limitBuy,
					remainingQuantity: this.shopList[shopIndex].hcCommodityList[foodIndex].remainingQuantity,
					merchantId: this.shopList[shopIndex].id
				};
				this.specShow = true;
				console.log('specInfo', this.specInfo);
			},
			//更改规格的选中状态
			changeSpecCheck(listIndex, childIndex) {
				this.$nextTick(() => {
					let total = 0;
					this.specInfo.specList[listIndex].child.forEach((item, index) => {
						if (index == childIndex) {
							item.checked = true;
						} else {
							item.checked = false;
						}
					});
					this.specInfo.specList.forEach(item => {
						item.child.forEach(childItem => {
							if (childItem.checked) {
								total = total + Number(childItem.price);
							}
						});
					});
					if (!this.specInfo.hasPrice) {
						this.specInfo.total = total;
					}
				});
			},
			//展示列表的购物车加减以及规格弹窗的添加至购物车
			async changeShopNum(type, shopCheckIndex, foodCheckIndex, value, listValue) {
				if (type == 'spec' && this.specInfo.limitBuy > -1 && this.specInfo.num >= this.specInfo
					.remainingQuantity) {
					this.$showToast.call(this, '库存不足，无法继续添加', 'warning');
					return;
				}

				if (type == 'spec' && this.specInfo.storeState == '打烊') {
					this.warnShow = true;
					setTimeout(() => {
						this.warnShow = false;
					}, 3000);
					return;
				}
				if (type == 'add' && listValue.businessState == '打烊') {
					this.warnShow = true;
					setTimeout(() => {
						this.warnShow = false;
					}, 3000);
					return;
				}

				// if (type == 'add' && value.limitBuy > -1 && value.num >= value.remainingQuantity) {
				// 	this.$showToast.call(this, '已超出库存，无法继续添加', 'warning');
				// 	return;
				// }
				if (type == 'add' && value.limitBuy > -1 && value.remainingQuantity <= 0) {
					this.$showToast.call(this, '已超出库存，无法继续添加', 'warning');
					return;
				}
				if (type == 'down') {
					if (value.num == 0) {
						return;
					}
				}
				if (!this.shakeFlag) {
					//设置防抖节点
					this.shakeFlag = true;
					// let oldVal, num, obj;
					let oldVal, obj;

					let merchantId;
					let commodityId;
					if (type == 'add' || type == 'down') {
						merchantId = this.shopList[shopCheckIndex].id;
						commodityId = this.shopList[shopCheckIndex].hcCommodityList[foodCheckIndex].id;
						let oldNum = this.shopList[shopCheckIndex].hcCommodityList[foodCheckIndex].num;
						let commodityQuantity = type == 'add' ? 1 : -1;
						this.shopList[shopCheckIndex].hcCommodityList[foodCheckIndex].num = oldNum + commodityQuantity;

						let oldRemainingQuantity = this.shopList[shopCheckIndex].hcCommodityList[foodCheckIndex]
							.remainingQuantity;
						this.shopList[shopCheckIndex].hcCommodityList[foodCheckIndex].remainingQuantity = type ==
							'add' ? oldRemainingQuantity - 1 : oldRemainingQuantity + 1;
						obj = {
							commodityId,
							commodityQuantity,
							commoditySpecifications: '',
							addressId: this.myAddress.id
						};
					}
					let tempArr = [],
						tempPrice = 0;
					if (type == 'spec') {
						this.specInfo.specList.forEach(item => {
							item.child.forEach(childItem => {
								if (childItem.checked) {
									tempArr.push(childItem.name);
									tempPrice = tempPrice + childItem.price;
								}
							});
						});
						obj = {
							commodityId: this.specInfo.shopId,
							commodityQuantity: 1,
							commoditySpecifications: tempArr.join(','),
							addressId: this.myAddress.id
						};

						merchantId = this.specInfo.merchantId;
						commodityId = this.specInfo.shopId;
						let merchantIndex = this.specInfo.shopIndex;
						let foodIndex = this.specInfo.foodIndex;

						this.shopList[merchantIndex].hcCommodityList[foodIndex].num++;
					}
					let res = await addShopCar(obj);
					this.getShopCarList() // 重新获取购物车信息

					let mIndex = type == 'add' || type == 'down' ? shopCheckIndex : this.specInfo.shopIndex;
					let pIndex = type == 'add' || type == 'down' ? foodCheckIndex : this.specInfo.foodIndex;
					console.log(this.shopList[mIndex]);
					let {
						id,
						logo,
						storeDescription,
						storeName,
						businessState,
						businessHours,
						hcCommodityList
					} = this.shopList[mIndex];
					let proInfo = hcCommodityList[pIndex];
					let {
						commodityPrice,
						commodityPriceCache,
						tradeName,
						remainingQuantity,
						productPicture,
						limitBuy,
						specificationsFlag,
						delFlag,
						num
					} = proInfo;
					//点击的商品组成的购物车商家对象
					let shopCarMerchantObj = {
						id,
						logo,
						storeDescription,
						storeName,
						businessState,
						businessHours
					};
					//点击的商品组成的购物车商品对象
					let shopCarFoodInfo = {
						remainingQuantity,
						id: '',
						// userId:this.myInfo.id,
						merchantId: id,
						commodityId: proInfo.id,
						commodityQuantity: num,
						commodityPrice: commodityPriceCache,
						commoditySpecifications: tempArr.join(','),
						hcCommodity: {
							id: proInfo.id,
							merchantId: id,
							tradeName: tradeName,
							commodityPrice,
							productPicture,
							limitBuy,
							specificationsFlag,
							delFlag,
							commoditySpecifications: proInfo.commoditySpecifications,
							commodityPriceCache
						}
					};

					if (this.shopCarInfo.shopCarList.length == 0) {
						shopCarMerchantObj.hcShoppingCartList = [shopCarFoodInfo];
						this.shopCarInfo.shopCarList.push(shopCarMerchantObj);
					} else {
						let flag = false,
							merchantFlag = false;
						//用点击的商品id，商家id与购物车数组进行比较--如存在记录则直接计算，不存在则加购物车的接口
						for (let j = 0; j < this.shopCarInfo.shopCarList.length; j++) {
							let item = this.shopCarInfo.shopCarList[j];
							let index = j;
							//如果存在与店家商品对应商家的id一致的则继续执行
							if (merchantId == item.hcShoppingCartList[0].hcCommodity.merchantId) {
								for (let i = 0; i < item.hcShoppingCartList.length; i++) {
									let foodItem = item.hcShoppingCartList[i];
									let foodIndex = i;
									//如果购物车对应商家存在对应商品id则继续执行
									if (foodItem.hcCommodity.id == commodityId) {
										console.log('我是重复的商品');
										if (type == 'spec') {
											console.log('44', tempArr.join(','), '55', foodItem
												.commoditySpecifications);
											if (tempArr.join(',') == foodItem.commoditySpecifications) {
												console.log('9999999999');
												flag = true;
												foodItem.commodityQuantity = foodItem.commodityQuantity + 1;
												break;
											}
										} else {
											flag = true;
											console.log('我不是规格');
											//将购物车对应商品的数量进行加减
											foodItem.commodityQuantity = type == 'add' ? foodItem.commodityQuantity +
												1 : foodItem.commodityQuantity - 1;
											//如果对应商品数量为0则删除对应商品
											if (foodItem.commodityQuantity == 0) {
												this.shopCarInfo.shopCarList[index].hcShoppingCartList.splice(
													foodIndex, 1);
												//如果对应商家的商品种类为0则删除商家
												if (this.shopCarInfo.shopCarList[index].hcShoppingCartList.length ==
													0) {
													this.shopCarInfo.shopCarList.splice(index, 1);
												}
											}
										}
									}
								}
								//没有重合的商品和规格直接添加
								if (!flag && type == 'spec') {
									console.log('我没有重复的规格');
									shopCarFoodInfo.commodityQuantity = 1;
									shopCarFoodInfo.hcCommodity.commodityPriceCache = this.specInfo.total;
									console.log('shopCarFoodInfo.commodityQuantity=1', shopCarFoodInfo
										.commodityQuantity == 1);
									item.hcShoppingCartList.push(shopCarFoodInfo);
								}
								//没有重复的商品直接添加
								if (!flag && type != 'spec') {
									console.log('我没有重复的商品');
									item.hcShoppingCartList.push(shopCarFoodInfo);
								}
								merchantFlag = true;
								break;
							}
						}
						//没有重合的商家直接添加
						if (!merchantFlag) {
							console.log('我没有重合的商家');
							shopCarMerchantObj.hcShoppingCartList = [shopCarFoodInfo];
							this.shopCarInfo.shopCarList.push(shopCarMerchantObj);
						}
					}
					console.log('我结束了');
					console.log(this.shopCarInfo.shopCarList);
					//将删除后的购物车数据重新进行汇总--算商品总数量以及商品总价
					this.getShopCarTotal();

					//关闭防抖节点
					this.shakeFlag = false;
					this.specShow = false;
					this.specInfo = '';
				}
			},
			//展示购物车列表
			changeShopCarShow() {
				this.shopCarShow = !this.shopCarShow;
			},

			// 购物车处的数量减
			down(shopIndex, listIndex) {
				let oldNum = this.shopCarList[shopIndex].foodList[listIndex].num;
				this.shopCarList[shopIndex].foodList[listIndex].num = oldNum <= 1 ? 1 : oldNum - 1;
			},
			// 购物车处的数量加
			add(shopIndex, listIndex) {
				let oldNum = this.shopCarList[shopIndex].foodList[listIndex].num;
				this.shopCarList[shopIndex].foodList[listIndex].num = oldNum + 1;
			},
			//页面跳转公用函数
			goToPage(type) {
				if (type == 'createOrder' && this.shopCarInfo.total <= 0) {
					this.$showToast.call(this, '请添加商品至购物车之后再进行结算', 'warning');
					return;
				}
				let url;
				switch (type) {
					case 'index':
						// url = '/pages/index/index';
						url = '/pages/home/index';
						break;
					case 'createOrder':
						url = '../my/order/createOrder?addressId=' + this.myAddress.id;
						break;
					case 'my':
						url = '../my/my';
						break;
					case "company":
						url = '/pages/order';
						break;
				}
				uni.navigateTo({
					url
				});
			},
			//购物车列表的数量加减
			async shopCarWithChangeNum(type, value, listValue, foodIndex, index) {
				if (type == 'add' && listValue.businessState == '打烊') {
					this.$showToast.call(this, '商家已经打样', 'warning');
					return;
				}
				if (type == 'add' && value.hcCommodity.limitBuy > -1 && value.commodityQuantity >= value
					.remainingQuantity) {
					this.$showToast.call(this, '已超出库存，无法继续添加', 'warning');
					return;
				}
				let commodityQuantity = 0;
				if (type == 'add') {
					commodityQuantity = 1;
				} else {
					if (value.commodityQuantity == 0) {
						return;
					}
				}
				let obj = {
					commodityId: value.hcCommodity.id,
					commodityQuantity: type == 'add' ? 1 : -1,
					commoditySpecifications: value.commoditySpecifications,
					addressId: this.myAddress.id
				};
				let res = await addShopCar(obj);
				this.shopListForAll.forEach(item => {
					item.hcCommodityList.forEach(childItem => {
						if (childItem.id == value.id) {
							childItem.commodityQuantity = type == 'add' ? childItem.commodityQuantity +
								1 : childItem.commodityQuantity - 1;
							childItem.remainingQuantity = type == 'add' ? childItem.commodityQuantity -
								1 : childItem.remainingQuantity + 1;
						}
					});
				});
				this.shopListForAll.forEach(item => {
					item.hcCommodityList.forEach(childItem => {
						if (childItem.id == value.commodityId) {
							childItem.value = type == 'add' ? (childItem.num = childItem.num + 1) : (
								childItem.num = childItem.num - 1);
							childItem.remainingQuantity = type == 'add' ? childItem.remainingQuantity -
								1 : childItem.remainingQuantity + 1;
						}
					});
				});

				// this.getShopCarList();

				//缓存点击购物车对应商品的数量
				let num = this.shopCarInfo.shopCarList[index].hcShoppingCartList[foodIndex].commodityQuantity;
				//如果是减数量
				if (type == 'down') {
					//如果点击商品的购物车数量为1则继续执行
					if (num == 1) {
						//如果点击该商家的购物车商品种类为1则删掉该购物车商家数据
						if (this.shopCarInfo.shopCarList[index].hcShoppingCartList.length == 1) {
							this.shopCarInfo.shopCarList.splice(index, 1);
						} else {
							//如果点击该商家的购物车商品种类不为1则删掉该该购物车商品数据
							this.shopCarInfo.shopCarList[index].hcShoppingCartList.splice(foodIndex, 1);
						}
					} else {
						//如果点击该商家的购物车商品种类不为1则正常减数量
						this.shopCarInfo.shopCarList[index].hcShoppingCartList[foodIndex].commodityQuantity = num - 1;
					}
				} else {
					//正常加数量
					this.shopCarInfo.shopCarList[index].hcShoppingCartList[foodIndex].commodityQuantity = num + 1;
				}
				//对购物车重新进行汇总--商品总数量以及商品总价
				this.getShopCarTotal();
			},
			//对购物车重新进行汇总--商品总数量以及商品总价
			getShopCarTotal() {
				let total = 0,
					totalPrice = 0;
				this.shopCarInfo.shopCarList.forEach(item => {
					item.hcShoppingCartList.forEach((foodItem, foodIndex) => {
						total = total + foodItem.commodityQuantity;
						foodItem.checked = false;
						console.log('+++++', foodItem.hcCommodity);
						console.log('-----', foodItem);
						totalPrice = this.accAdd(
							totalPrice,
							foodItem.hcCommodity.commodityPriceCache ? this.accMul(foodItem.hcCommodity
								.commodityPriceCache, foodItem.commodityQuantity) : foodItem
							.commodityPrice
						);
					});
				});
				this.shopCarInfo.total = total;
				this.shopCarInfo.totalPrice = totalPrice;
			},
			//清空购物车
			async emptyShopCar() {
				let shopCarWidthMerchantIdArr = []; //用于存储所有购物车列表的商家id
				let shopCarWithFoodIdArr = []; //用于存储所有购物车列表的商品id
				this.shopCarInfo.shopCarList.forEach((shopCarItem, shopCarIndex) => {
					console.log('shopCarItem', shopCarItem);
					shopCarWidthMerchantIdArr.push(shopCarItem.hcShoppingCartList[0].hcCommodity.merchantId);
					shopCarItem.hcShoppingCartList.forEach((foodItem, foodIndex) => {
						shopCarWithFoodIdArr.push({
							foodId: foodItem.hcCommodity.id,
							num: foodItem.commodityQuantity
						});
					});
				});
				//将购物车的商家id转成字符串--便于后面用indexOf的方式判断商家是否包含该店铺（少写一层循环）
				let shopCarWidthMerchantIdStr = shopCarWidthMerchantIdArr.join(',');
				//循环判断商品列表和购物车列表重合的地方
				this.shopListForAll.forEach((shopItem, shopIndex) => {
					//如果要清除的购物车数据与商品列表有重合的商家则继续执行
					if (shopCarWidthMerchantIdStr.indexOf(shopItem.id) != -1) {
						shopItem.hcCommodityList.forEach((foodItem, foodIndex) => {
							shopCarWithFoodIdArr.forEach((shopCarFoodItem, shopCarFoodIndex) => {
								//如果要清除的购物车数据与商品列表有重合的商品则继续执行
								if (shopCarFoodItem.foodId == foodItem.id) {
									foodItem.remainingQuantity = foodItem.remainingQuantity +
										foodItem.num; //将清除的数据重新增加到'剩余数量'
									foodItem.num = 0; //清除对应的input数据
								}
							});
						});
					}
				});
				//将购物车列表及数据清空
				this.shopCarInfo = {
					total: 0,
					totalPrice: 0,
					shopCarList: []
				};

				let res = await emptyShopCar();
				this.shopCarShow = false;

				// this.getShopCarList();
				// this.getStoreList()
			},

			//下拉触底加载更多当前地址的下单记录
			getMoreOrder() {
				let scrollTop = document.getElementById('listContent').scrollTop; //滚动高度
				let clientHeight = document.getElementById('listContent').clientHeight; //可视高度
				let scrollHeight = document.getElementById('listContent').scrollHeight; //内容高度
				if (scrollHeight - scrollTop - 10 <= clientHeight) {
					if (!this.moreOrderFlag) {
						this.moreOrderFlag = true;
						if (this.orderList.length != 0 && this.orderList.length % 10 == 0) {
							this.orderPageNo = this.orderPageNo + 1;
							this.getCreateOrderNum('push');
							setTimeout(() => {
								this.moreOrderFlag = false;
							}, 1000);
						}
					}
				}
			},

			async checkShopCarInfo() {
				let res = await checkShopCarInfo({
					addressId: this.myAddress.id
				});
				console.log('res', res);
				if (res.data.success) {
					uni.navigateTo({
						url: '../my/order/createOrder?addressId=' + this.myAddress.id
					});
				} else {
					this.$showToast.call(this, res.data.message, 'default', 4000);

					// uni.navigateTo({
					// 	url: '../my/order/createOrder?addressId=' + this.myAddress.id
					// })
				}
			},

		},

		watch: {
			//监控是否全选
			hasAllCheck(newVal) {
				this.shopCarInfo.shopCarList.forEach((item, index) => {
					item.hcShoppingCartList.forEach(foodItem => {
						foodItem.checked = newVal;
					});
				});
			}
		},
		destory() {},
		onHide() {
			this.timerList.forEach(val => {
				clearInterval(val);
			})
			this.timerList = [];
			this.storePageNo = 1;
		},

	};
</script>

<style lang="scss" scoped>
	.indexBig {
		height: 100vh;
		background-repeat: no-repeat;
		background-color: #f5f5f5;
		overflow: hidden;
	}

	// 倒计时
	.swiperContent {
		width: calc(100% - 40rpx);
		background-color: #fff;
		margin: 0 20rpx 40rpx 20rpx;
		border-radius: 20rpx;
		transform: rotate(0deg);
		-webkit-transform: rotate(0deg);
		overflow: hidden;
	
		/deep/swiper {
			height: 300rpx;
		}
	
		.countTop {
			padding: 20rpx 20rpx;
			background-color: #ffe2cd;
			height: 100rpx;
			@include flexs(space-between, center);
			font-size: 28rpx;
			color: #513f10;
	
			text {
				font-size: 50rpx;
				margin: 0 10rpx;
				font-weight: 900;
				color: #fc360b;
			}
		}
	
		.countCount {
			background-color: #ffece1;
			padding: 40rpx 0 60rpx 0;
			@include flexs(center, center);
			flex-direction: column;
			letter-spacing: 4rpx;
			perspective: 1000;
			height: 300rpx;
	
			>view {
				@include flexs();
				color: #7a642c;
	
				transition: 0.6s;
				transform-style: preserve-3d;
	
				&:nth-child(2) {
					margin-top: 10rpx;
				}
	
				>view {
					letter-spacing: 0;
					font-size: 120rpx;
					line-height: 1;
					font-weight: 900;
					color: #fc700b;
					// margin-top: 20rpx;
					@include flexs();
	
					&:nth-child(2),
					&:nth-child(4) {
						margin: 0 10rpx;
					}
				}
	
				.card {
					letter-spacing: 0;
					font-size: 120rpx;
					line-height: 1;
					font-weight: bold;
					color: #fc700b;
					transform-origin: bottom;
	
					// animation-iteration-count: infinite;
					animation: show 1s infinite;
				}
			}
		}
	
		.imageContent {
			width: 100%;
			height: 100%;
			// padding-bottom: 48%;
			position: relative;
	
			image {
				position: absolute;
				left: 0;
				top: 0;
				bottom: 0;
				right: 0;
				max-width: 100%;
				max-height: 100%;
				margin: 0 auto;
				width: 100%;
				height: 100%;
			}
		}
	}
	
	.list {
		width: 140rpx;
		font-size: 26rpx;
		line-height: 2;
		text-align: center;
		flex-shrink: 0;

		&:active {
			transform: scale(1.1);
		}

		.imageContent {
			width: 104rpx;
			padding-bottom: 104rpx;
			position: relative;
			margin: 0 auto;

			image {
				width: 100%;
				height: 100%;
				position: absolute;
				left: 0;
				top: 0;
				// border-radius: 50%;
			}
		}

		&:nth-child(1) {
			margin-left: 0;
		}
	}





	.hotelBox {
		padding: 0 20rpx;
		height: 100%;
		overflow: auto;
		padding-bottom: 245rpx;
	}

	.hotellList {
		border-radius: 40rpx;
		padding: 40rpx 20rpx;
		background-color: #fff;
		margin-bottom: 40rpx;

		.hotelInfo {
			@include flexs();
			position: relative;

			.fixBox {
				width: 100%;
				height: 100%;
				position: absolute;
				left: 0;
				top: 0;
				background-color: rgba(0, 0, 0, 0.55);
				color: #fff;
				font-size: 32rpx;
				@include flexs(center, center);
			}

			image {
				width: 150rpx;
				height: 150rpx;
				border-radius: 10rpx;
				flex-shrink: 0;
			}

			.topRight {
				width: calc(100% - 170rpx);
				margin-left: 20rpx;
				@include flexs(space-between, flex-start);
				flex-direction: column;

				>view:nth-child(1) {
					width: 100%;
					@include flexs(space-between, center);

					>view:nth-child(1) {
						font-size: 32rpx;
						font-weight: bold;
						flex: 1;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}

					>.notEnd {
						@include flexs(flex-end, center);
						width: 37%;
						flex-shrink: 0;
						font-size: 22rpx;
						color: rgba(0, 0, 0, 0.55);

						>view:nth-child(1) {
							margin-left: 10rpx;
							background: linear-gradient(271.21deg, #f25b48 -4.12%, #f68758 99.23%);
							color: #fff;
							padding: 0 5rpx;
							border-bottom-left-radius: 5rpx;
							border-top-left-radius: 5rpx;
						}

						>view:nth-child(2) {
							background: #ffdddd;
							padding: 0 5rpx;
							color: #ff0000;
							font-weight: bold;
							border-top-right-radius: 5rpx;
							border-bottom-right-radius: 5rpx;
						}
					}

					>.end {
						background-color: #e9ebed;
						border-radius: 20rpx;
						color: rgba(0, 0, 0, 0.55);
						font-size: 22rpx;
						line-height: 1.5;
						padding: 0 10rpx;

						text {
							color: #040404;
							margin-left: 10rpx;
						}
					}
				}

				>view:nth-child(2) {
					@include flexs(flex-start, center);
					font-size: 24rpx;
					line-height: 2;
					width: 100%;

					>view {
						width: calc(100% / 3);
						flex: 1;
					}

					text {
						color: #f52a2a;
						margin-left: 10rpx;
					}
				}

				>view:nth-child(3) {
					width: 100%;
					@include flexs(space-between, center);
					font-size: 22rpx;
					line-height: 2;
				}

				>view:nth-child(4) {
					width: 100%;
					@include flexs(space-between, center);
					font-size: 22rpx;
					line-height: 2;
				}
			}
		}

		.shopContent {
			@include flexs(space-between, flex-start);
			padding: 20rpx 0;
			flex-wrap: wrap;

			.shopList {
				width: calc((100% - 20rpx) / 2);
				margin-bottom: 20rpx;

				.imgContent {
					// width: 44vw;
					// height: 44vw;

					padding-bottom: calc(30 / 38 * 100%);
					position: relative;
					// border-radius: 20rpx;
					overflow: hidden;

					.must {
						position: absolute;
						right: 10rpx;
						top: 10rpx;
						background-color: #fa690a;
						color: #fff;
						font-size: 20rpx;
						border-radius: 5rpx;
						padding: 0 10rpx;
						line-height: 1.5;
						font-weight: bold;
					}

					image {
						// width: 100%;
						// height: 100%;

						position: absolute;
						left: 0;
						top: 0;
						bottom: 0;
						right: 0;
						max-width: 100%;
						max-height: 100%;
						margin: auto;
						width: auto;
						height: auto;
					}
				}
			}

			.shopInfo {
				padding: 10rpx 0;

				.shopName {
					font-size: 28rpx;
					line-height: 1.5;
					// text-overflow: ellipsis;
					// overflow: hidden;
					// white-space: nowrap;
				}

				.shopDescribe {
					min-height: 48rpx;
					font-size: 24rpx;
					line-height: 2;
					color: rgba(0, 0, 0, 0.35);
					margin-bottom: 10rpx;
					text-overflow: ellipsis;
					overflow: hidden;
					white-space: nowrap;
				}

				.control {
					@include flexs(space-between, center);
					font-size: 24rpx;
					position: relative;

					.surplus {
						color: rgba(0, 0, 0, 0.55);
						@include flexs(flex-start, center);
						flex-wrap: wrap;
					}

					.price {
						font-size: 32rpx;
						color: #fa690a;
						font-weight: bold;
						margin-right: 10rpx;

						text {
							font-size: 24rpx;
							font-weight: 400;
						}
					}

					.specConetnt {
						background: #fa690a;
						border-radius: 4px;
						padding: 5rpx 10rpx;
						color: #fff;
					}

					.num {
						width: 30rpx;
						height: 30rpx;
						font-size: 20rpx;
						border-radius: 50%;
						background-color: #f60000;
						position: absolute;
						right: -10rpx;
						top: -10rpx;
						line-height: 30rpx;
						text-align: center;
						color: #fff;
					}

					.showInput {
						width: 50%;
						@include flexs(center, center);
						color: #00000080;
						border-radius: 50rpx;
						border: 1px solid #eee;

						svg {
							margin: 0 10rpx;
						}

						view {
							width: 50rpx;
							height: 50rpx;
							text-align: center;
							line-height: 25rpx;
							font-size: 20px;
						}
					}
				}
			}
		}

		.more {
			text-align: center;
			font-size: 24rpx;
			@include flexs(center, center);
			border-top: 1px solid #eee;
			line-height: 2;
			padding-top: 20rpx;

			image {
				transform: rotate(0);
				width: 25rpx;
				height: 25rpx;
				margin-left: 10rpx;
			}
		}
	}

	.storeListBox.hotelBox {

		.hotellList {
			margin-top: 20rpx;
			margin-bottom: 0rpx;
			border-radius: 16rpx;
			padding: 14rpx 10rpx;

			.hotelInfo uni-image {
				height: 130rpx;
				width: 130rpx;
			}

		}

		.des-box {
			display: flex;
			flex-wrap: wrap;

			// width: 80%;
			.des-item {
				margin-top: 5px;
				font-size: 25rpx;
				margin-right: 20rpx;
				padding: 2rpx 12rpx;
				color: #f38d09;
				border-radius: 10rpx;
				background-color: rgba(255, 141, 0, 0.22);

			}
		}

	}
	.timeAndFavorite {
		display: flex;
		justify-content: space-around;

		.ai-xin {
			position: relative;
			width: 40rpx !important;
			height: 40rpx !important;
			// right: 20rpx;
			// bottom: 20rpx;
		}
	}
	.food-back-btn {
		background-color: #e1e1e1;
		border-radius: 10rpx;
		width: 100rpx;
		text-align: center;
		margin: 10rpx 0px;
	}

	.empty-data {
		width: 100%;
		height: 50vh;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.shopCarBottom {
		z-index: 2;
		position: fixed;
		// left: 0;
		bottom: 100rpx;
		width: 100%;
		height: 116rpx;
		margin: 0 auto;
		background-color: #fff;
		box-shadow: 5px 0px 5px rgba(0, 0, 0, 0.05);
		@include flexs(space-between, center);
		padding: 18rpx 32rpx;

		image {
			width: 60rpx;
			height: 60rpx;
		}

		>view {
			&:nth-child(1) {
				>view {
					position: relative;

					>.num {
						position: absolute;
						right: -5px;
						top: -5px;
						font-size: 20rpx;
						width: 30rpx;
						height: 30rpx;
						border-radius: 50%;
						text-align: center;
						line-height: 30rpx;
						color: #fff;
						background-color: red;
					}
				}

				>view:nth-child(2) {
					margin-left: 20rpx;
					font-weight: bold;
					font-size: 32rpx;
				}
			}

			@include flexs();

			&:nth-child(2) {
				background-color: #fa690a;
				color: #fff;
				border-radius: 30rpx;
				font-size: 28rpx;
				width: 206rpx;
				height: 80rpx;
				line-height: 80rpx;
				border-radius: 60rpx;
				text-align: center;
				display: block;
			}
		}

		>.dis {
			background-color: #bababa !important;
			color: #fff !important;
		}
	}

	.orderDet {
		// -webkit-overflow-scrolling: touch;

		/deep/.u-empty {
			min-height: 30vh;
		}

		>view:nth-child(1) {
			text-align: center;
			font-size: 32rpx;
			line-height: 2;
		}

		>view:nth-child(2) {
			text-align: center;
			font-size: 28rpx;
			line-height: 2;
		}

		.listContent {
			// max-height: 50vh;
			// min-height: 30vh;
			// overflow-y: scroll;
			// overflow-x: hidden;
			// -webkit-overflow-scrolling: touch;

			>.list {
				@include flexs();
				font-size: 22rpx;
				line-height: 74rpx;
				margin: 20rpx 0;
				padding: 10rpx 0;
				background-color: #f3f3f3;

				>view:nth-child(1) {
					text-align: center;
					width: 10%;
					margin: 0 1%;
				}

				>view:nth-child(2) {
					width: calc(22rpx * 6);
					text-overflow: ellipsis;
					overflow: hidden;
					white-space: nowrap;
				}

				>view:nth-child(3) {
					flex: 1;
					text-overflow: ellipsis;
					overflow: hidden;
					white-space: nowrap;
					margin: 0 1.5%;
				}

				>view:nth-child(4) {
					font-size: 22rpx;
					width: calc(22rpx * 7);
					text-overflow: ellipsis;
					overflow: hidden;
					white-space: nowrap;
				}
			}
		}
	}

	.posiContent {
		>view {
			&:nth-child(1) {
				font-size: 28rpx;
				color: rgba(0, 0, 0, 0.35);
				margin-bottom: 14rpx;
			}
		}

		>.listContent {
			margin-top: 10rpx;

			>view {
				.list {
					border-bottom: 1px solid rgba(0, 0, 0, 0.05);
					font-size: 28rpx;
					line-height: 40rpx;
					padding: 24rpx 0;
				}

				&:last-child {
					border-bottom: 0;

					.list {
						border: 0;
					}
				}
			}
		}
	}

	.specBox {
		/deep/.u-mode-center-box {
			min-height: auto;
		}

		.specContent {
			min-height: 20vh;
			position: relative;

			>view:nth-child(1) {
				font-size: 36rpx;
				line-height: 1;
				font-weight: bold;
				margin-bottom: 32rpx;
			}

			>.specList {
				margin-bottom: 20rpx;

				>view {
					@include flexs();
					flex-wrap: wrap;
					font-size: 24rpx;
					line-height: 1.5;

					&:nth-child(1) {
						font-size: 28rpx;
						margin-bottom: 20rpx;
					}

					&:nth-child(2) {
						>view {
							margin-bottom: 10rpx;
							@include flexs();
							margin-right: 10rpx;
							border-radius: 10rpx;
							overflow: hidden;
							border: 0.5px solid rgba(0, 0, 0, 0.1);
							line-height: 2;

							>view {
								padding: 0 10rpx;

								&:nth-child(2) {
									border-left: 1px solid rgba(0, 0, 0, 0.1);
									color: #f50000;
									background-color: #f5f5f5;
								}

								&:nth-child(1) {
									background-color: #f5f5f5;
								}
							}
						}

						>.specCheckList {
							border: 1px solid #fa690a;

							>view {
								&:nth-child(1) {
									color: #fa690a;
									background-color: #fff8f0;
								}

								&:nth-child(2) {
									border-left: 1px solid #fa690a;
									background-color: #fff8f0;
								}
							}
						}
					}
				}
			}
		}

		.specControl {
			@include flexs(space-between, center);
			margin-top: 50rpx;

			>view:nth-child(1) {
				font-size: 24rpx;

				text {
					font-size: 36rpx;
					font-weight: bold;
					color: #f50000;
					margin-left: 10rpx;
				}
			}

			>view:nth-child(2) {
				color: #fff;
				font-size: 28rpx;
				width: 346rpx;
				height: 88rpx;
				line-height: 88rpx;
				border-radius: 60rpx;
				background-color: #fa690a;
				display: block;
				text-align: center;
			}
		}
	}

	.shopCarBox {
		width: 100%;
		background-color: #fff;
		position: fixed;
		z-index: 2;
		bottom: 216rpx;
		// left: 0;
		border-bottom: 1px solid #eee;
		border-top-left-radius: 20rpx;
		border-top-right-radius: 20rpx;
		overflow: hidden;

		// box-shadow: 0 -5px 5px #eee;
		.u-empty {
			min-height: 25vh;
		}

		.shopCarContent {
			padding: 20rpx;
			max-height: 40vh;
			overflow-y: auto;

			>view:nth-child(1) {
				@include flexs(space-between, center);
				font-size: 28rpx;
				line-height: 2;
				color: rgba(0, 0, 0, 0.35);

				label,
				view {
					@include flexs(flex-end, center);
				}

				image {
					width: 40rpx;
					height: 40rpx;
					margin-right: 16rpx;
				}
			}

			.shopList {
				>view:nth-child(1) {
					margin: 20rpx 0;
					@include flexs();
					border-bottom: 1px solid #eee;
					padding: 32rpx 0;

					image {
						width: 100rpx;
						height: 100rpx;
						margin-right: 24rpx;
						border-radius: 16rpx;
						flex-shrink: 0;
					}

					>view {
						height: 100rpx;
						@include flexs(space-between, flex-start);
						flex-direction: column;
						padding: 5rpx 0;

						>view {
							&:nth-child(1) {
								font-size: 28rpx;
								font-weight: bold;
							}

							&:nth-child(2) {
								font-size: 24rpx;
								color: rgba(0, 0, 0, 0.55);
								display: -webkit-box;
								-webkit-line-clamp: 2;
								-webkit-box-orient: vertical;
								overflow: hidden;
							}
						}
					}
				}

				.foodList {
					@include flexs();
					margin: 40rpx 0;

					>view {
						width: 100%;
						@include flexs();

						image {
							width: 108rpx;
							height: 108rpx;
							margin-right: 20rpx;
							flex-shrink: 0;
							object-fit: cover;
							border-radius: 16rpx;
						}

						>view {
							flex: 1;
							height: 108rpx;
							@include flexs(space-between, flex-start);
							flex-direction: column;

							>view {
								@include flexs(space-between, center);
								width: 100%;

								&:nth-child(1) {
									font-size: 28rpx;
									font-weight: bold;
								}

								&:nth-child(2) {
									font-size: 12px;
									color: #000;
									font-weight: bold;
								}

								>view {
									@include flexs();

									&:nth-child(2) {
										border-radius: 50rpx;
										border: 1px solid #eee;
									}

									&:nth-child(1) {
										font-size: 28rpx;
										// font-weight: bold;
									}

									svg {
										margin: 0 10rpx;
									}

									>view {
										width: 50rpx;
										height: 50rpx;
										font-size: 36rpx;
										text-align: center;
										line-height: 50rpx;
										font-weight: 400;
									}

									/deep/.u-input__input {
										flex: 1;
										line-height: 50rpx;
										height: 50rpx;
										font-size: 28rpx;
										min-height: 50rpx !important;
										text-align: center;
									}
								}
							}
						}
					}
				}
			}
		}

		/deep/.uni-checkbox-input {
			border-radius: 50%;
			width: 40rpx;
			height: 40rpx;
		}

		/deep/.uni-checkbox-input-checked {
			border-color: #f1b825 !important;

			&:before {
				content: '';
				width: 35rpx;
				height: 35rpx;
				background-color: #f1b825;
				border-radius: 50%;
				display: block;
			}
		}
	}

	.blackBox {
		width: 100%;
		height: 100vh;
		background-color: rgba(0, 0, 0, 0.5);
		position: fixed;
		left: 0;
		top: 0;
		display: none;
	}

	.show {
		display: block;
	}

	.storeDet {
		>view {
			font-size: 28rpx;
			line-height: 2;
			font-weight: bold;
			text-align: center;
			margin-bottom: 20rpx;
		}
	}

	/* 定义动画 */
	@-webkit-keyframes show {
		0% {
			transform: rotateX(180deg);
			opacity: 0;
		}

		50% {
			transform: rotateX(25deg);
			opacity: 1;
		}

		60% {
			transform: rotateX(-25deg);
			opacity: 1;
		}

		70% {
			transform: rotateX(25deg);
			opacity: 1;
		}

		80% {
			transform: rotateX(-6deg);
			opacity: 1;
		}

		90% {
			transform: rotateX(6deg);
			opacity: 1;
		}

		100% {
			transform: rotateX(0);
			opacity: 1;
		}
	}

	/* 定义一个回去的动画 */
	@-webkit-keyframes hide {
		0% {
			transform: rotateX(0);
			opacity: 1;
		}

		100% {
			transform: rotateX(180deg);
			opacity: 0;
		}
	}

	.warnBox {
		width: 100%;
		height: 100vh;
		@include flexs(center, center);
		position: fixed;
		left: 0;
		top: 0;
		z-index: 99999999;
		transition: all 0.2s;
		display: none;

		>view {
			width: 80%;
			height: 100rpx;
			background-color: rgba(0, 0, 0, 0.7);
			border-radius: 20rpx;
			color: #fff;
			@include flexs(center, center);
		}
	}

	.warnBoxShow {
		display: flex;
	}
</style>
<style lang="scss">
	swiper {
		height: 400rpx !important;
		padding: 0 !important;
		margin: 0 !important;
	}

	.searchBox {
		.u-input {
			flex: 1;
			text-indent: 20rpx;
			color: rgba(0, 0, 0, 0.35);
			line-height: 2;
			font-size: 28rpx !important;
		}
	}

	.showInput {
		/deep/.u-input__input {
			flex: 1;
			line-height: 50rpx;
			height: 50rpx;
			font-size: 28rpx;
			min-height: 50rpx !important;
			text-align: center;
		}
	}

	.indexBig {
		/deep/.u-mode-center-box {
			width: 90% !important;
			max-height: 80vh;
			padding: 40rpx 20rpx;
			border-radius: 20rpx;
			min-height: 30vh;
		}

		.alertBox {
			width: 100%;

			.title {
				font-size: 30rpx;
				text-align: center;
				font-weight: bold;
				line-height: 2;
				text-algin: center;
			}

			.content {
				width: 90%;
				text-align: center;
				margin: 40rpx auto;
			}
		}
	}

	.posiBottom {
		/deep/.u-drawer-bottom {
			width: 100% !important;
			padding: 36rpx 20rpx 40rpx 20rpx;
			border-top-left-radius: 40rpx;
			border-top-right-radius: 40rpx;
			min-height: 30vh;
			max-height: 80vh;
			overflow: auto;
		}

		/deep/ {
			.u-drawer__scroll-view {
				max-height: 80vh;
			}
		}
	}

	.storeDet {
		/deep/.u-drawer-top {
			max-height: 80vh !important;
			overflow-y: scroll;
			padding: 0 20rpx 0 20rpx;
			// border-top-left-radius: 40rpx;
			// border-top-right-radius: 40rpx;
			// min-height: 30vh;
		}
	}

	.orderContent {
		/deep/.u-drawer__scroll-view {
			max-height: 50vh;
		}
	}

	.storeDet {
		/deep/.u-drawer-bottom {
			width: 100% !important;
			padding: 36rpx 20rpx 40rpx 20rpx;
			border-top-left-radius: 40rpx;
			border-top-right-radius: 40rpx;
			min-height: 30vh;
			overflow: auto;
		}

		/deep/ {
			.u-drawer__scroll-view {
				max-height: 80vh;
			}
		}
	}

	.imgContent {
		/deep/.u-wrap {
			image {
				position: absolute;
				left: 0;
				top: 0;
				bottom: 0;
				right: 0;
				max-width: 100%;
				max-height: 100%;
				margin: auto;
				width: auto !important;
				height: auto !important;
			}
		}
	}

	.btn-v-console {
		width: 40px;
		height: 40px;
		// background: red;
		position: fixed;
		bottom: 0px;
		left: 0px;
		z-index: 3;
	}
</style>